import Service from "@/service";

//获取所有角色
export function getAllRole() {
    return Service.get('/api/role/getAll');
}

//通过用户id查询拥有的角色
export function getRolesByUserId(params: any) {
    return Service.get('/api/role/getRolesByUserId', {params})
}

//通过参数查询所有角色信息
export function getRoleDataByParams(params: any) {
    return Service.get('/api/role/getDataByParams', {params})
}

//通过用户id查询所有角色对象
export function getRolesObjByUserId(params: string) {
    return Service.get('/api/role/getRolesObjByUserId', {params})
}

//保存角色信息与菜单信息
export function saveRoleWithMenus(params: any) {
    return Service.post('/api/role/saveRoleWithMenus', params);
}

//删除角色
export function delRole(params: any) {
    return Service.post('/api/role/del', params)
}

export function downloadRole(params: any) {
    return Service.request({
        url: '/api/role/download',
        method: 'get',
        params: params,
        responseType: 'blob'
    })
}
